package a.f.d.a;

import a.c.bb;
import a.c.e;
import a.c.k;
import a.c.v;
import a.c.w;
import a.c.x;
import a.f.ad;
import a.f.o;
import a.i.db;

import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;

public abstract class f
  implements mc
{
  private byte a = 0;
  private int c = 4;
  public static int d;
  
  public int a()
  {
    return this.c;
  }
  
  public void a(int paramInt)
  {
    this.c = paramInt;
  }
  
  public void a(byte paramByte)
  {
    this.a = paramByte;
  }
  
  public byte b()
  {
    return this.a;
  }
  
  public abstract void a(o paramo, ac paramac, bc parambc, rb paramrb);
  
  public void b(o paramo, ac paramac, bc parambc, rb paramrb)
  {
    b_ localb_ = c(paramo, paramac, parambc, paramrb);
    Comparator[] arrayOfComparator = a(localb_, paramo, paramac, parambc);
    a(arrayOfComparator[0], arrayOfComparator[1], paramo, paramac, parambc, paramrb);
    a(localb_, paramo, parambc, paramrb);
  }
  
  protected void a(Comparator paramComparator1, Comparator paramComparator2, o paramo, ac paramac, bc parambc, rb paramrb)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    int i = 0;
    label110:
    do
    {
      do
      {
        if (i >= paramac.a()) {
          break;
        }
        vb localvb = paramac.a(i);
        v localv = localvb.c().f();
        do
        {
          if (localv == null) {
            break label110;
          }
          e locale = (e)localv.c();
          if (bool1) {
            break;
          }
          if (parambc.a(locale).d() == 0) {
            a(locale, paramComparator1, paramComparator2, paramo, parambc, paramrb);
          }
          localv = localv.a();
        } while (!bool1);
        i++;
      } while (bool2);
    } while (!bool1);
  }
  
  protected abstract void a(e parame, Comparator paramComparator1, Comparator paramComparator2, o paramo, bc parambc, rb paramrb);
  
  protected b_ c(o paramo, ac paramac, bc parambc, rb paramrb)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    b_ localb_ = new b_();
    int i = 0;
    label30:
    label293:
    do
    {
      do
      {
        if (i >= paramac.a()) {
          break;
        }
        vb localvb = paramac.a(i);
        v localv1 = localvb.c().f();
        do
        {
          if (localv1 == null) {
            break label293;
          }
          e locale1 = (e)localv1.c();
          ec localec = parambc.a(locale1);
          if (bool1) {
            break;
          }
          if (localec.c() > 0)
          {
            v localv2 = localec.b();
            do
            {
              if (localv2 == null) {
                break label276;
              }
              a.c.d locald = (a.c.d)localv2.c();
              if (bool2) {
                break label30;
              }
              if (bool1) {
                break;
              }
              if (locald.e().equals(locale1))
              {
                e locale2 = paramo.i();
                localb_.a(locale2, locald);
                if (!bool2)
                {
                  if (parambc.a(locald).l())
                  {
                    paramrb.b(locale2, locale1, locald, false, true);
                    paramrb.a(locale2, locald.f(), locald, false, true);
                    if (bool2) {
                      continue;
                    }
                    if (!bool1) {}
                  }
                  else
                  {
                    paramrb.a(locale1, locale2, locald, true, false);
                  }
                }
                else {
                  paramrb.b(locald.f(), locale2, locald, true, false);
                }
              }
              localv2 = localv2.a();
            } while (!bool1);
          }
          localv1 = localv1.a();
          if (bool2) {
            break;
          }
        } while (!bool1);
        i++;
      } while (bool2);
    } while (!bool1);
    label276:
    return localb_;
  }
  
  protected void a(b_ paramb_, o paramo, bc parambc, rb paramrb)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    w localw = paramb_.a().l();
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        e locale = localw.d();
        a.c.d locald1 = paramb_.a(locale);
        paramo.g(locald1);
        y localy1 = parambc.a(locald1);
        if (bool1) {
          break label654;
        }
        a.c.d locald2;
        a.c.d locald3;
        y localy2;
        y localy3;
        if (locale.e() > 0)
        {
          locald2 = locale.h();
          locald3 = locale.j();
          localy2 = parambc.a(locald2);
          localy3 = parambc.a(locald3);
          if (locald2.f() == locald1.e())
          {
            if (!bool2) {
              if (localy2.f() != localy1.d()) {
                paramrb.a(locald1, true, localy2.f());
              }
            }
            if ((bool2) || (localy3.f() != localy1.f())) {
              paramrb.a(locald1, false, localy3.f());
            }
            paramo.a(locald1, paramo.q(locald2));
            paramo.b(locald1, paramo.q(locald3));
            if (bool2) {
              continue;
            }
            if (!bool1) {}
          }
          else
          {
            if (!bool2) {
              if (localy3.f() != localy1.d()) {
                paramrb.a(locald1, true, localy3.f());
              }
            }
            if ((bool2) || (localy2.f() != localy1.f())) {
              paramrb.a(locald1, false, localy2.f());
            }
            paramo.a(locald1, paramo.q(locald3));
            paramo.b(locald1, paramo.q(locald2));
            if (bool2) {
              continue;
            }
            if (!bool1) {}
          }
        }
        else
        {
          locald2 = locale.i();
          locald3 = locale.k();
          localy2 = parambc.a(locald2);
          localy3 = parambc.a(locald3);
          if (locald2.e() == locald1.e())
          {
            if (!bool2) {
              if (localy2.d() != localy1.d()) {
                paramrb.a(locald1, true, localy2.d());
              }
            }
            if ((bool2) || (localy3.d() != localy1.f())) {
              paramrb.a(locald1, false, localy3.d());
            }
            paramo.a(locald1, paramo.p(locald2));
            paramo.b(locald1, paramo.p(locald3));
            if (bool2) {
              continue;
            }
            if (!bool1) {}
          }
          else
          {
            if (!bool2) {
              if (localy3.d() != localy1.d()) {
                paramrb.a(locald1, true, localy3.d());
              }
            }
            if ((bool2) || (localy2.d() != localy1.f())) {
              paramrb.a(locald1, false, localy2.d());
            }
            paramo.a(locald1, paramo.p(locald3));
            paramo.b(locald1, paramo.p(locald2));
          }
        }
        paramo.f(locald1);
        localw.f();
      } while (!bool1);
    } while (bool2);
    localw = paramb_.a().l();
    label654:
    do
    {
      while (!bool1)
      {
        if (!localw.e()) {
          break;
        }
        paramo.a(localw.d());
        localw.f();
      }
    } while (bool2);
  }
  
  private Comparator[] a(b_ paramb_, o paramo, ac paramac, bc parambc)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    int[] arrayOfInt = new int[paramo.j()];
    cc localcc = cc.a(paramo, paramac, parambc, arrayOfInt, new int[paramo.j()], new byte[paramo.l()], new int[paramo.l()], new byte[paramo.l()], new int[paramo.l()], (byte)1, (byte)0);
    Object localObject1 = paramb_.a().l();
    do
    {
      if (!((w)localObject1).e()) {
        break;
      }
      int i = ((w)localObject1).d().f();
      arrayOfInt[i] = -1;
      ((w)localObject1).f();
    } while (!bool1);
    localObject1 = localcc.e(true);
    if (!bool2) {
      if ((localObject1 instanceof cc.b_))
      {
        localObject2 = (cc.b_)localObject1;
        ((cc.b_)localObject2).a(new a_(paramo.c(ad.r), ((cc.b_)localObject2).a(), this.a, this.c));
      }
    }
    Object localObject2 = localcc.e(false);
    if (!bool2) {
      if ((localObject2 instanceof cc.m_))
      {
        cc.m_ localm_ = (cc.m_)localObject2;
        localm_.a(new a_(paramo.c(ad.q), localm_.a(), this.a, this.c));
      }
    }
    return new Comparator[] { localObject2, localObject1 };
  }
  
  static class a_
    implements Comparator, l.j_
  {
    private final k a;
    private final Comparator b;
    private final byte c;
    private final int d;
    
    a_(k paramk, Comparator paramComparator, byte paramByte, int paramInt)
    {
      this.a = paramk;
      this.b = paramComparator;
      this.d = paramInt;
      this.c = paramByte;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool2 = d.R;
      boolean bool1 = d.Q;
      if (!bool2) {
        if (this.b != null)
        {
          if (bool2) {
            break label54;
          }
          if (this.b.compare(paramObject1, paramObject2) != 0) {
            return this.b.compare(paramObject1, paramObject2);
          }
        }
      }
      label54:
      if (!bool2) {
        if (this.a == null) {
          return 0;
        }
      }
      Collection localCollection1 = (Collection)this.a.get(paramObject1);
      Collection localCollection2 = (Collection)this.a.get(paramObject2);
      if (!bool2) {
        if (localCollection1 == null)
        {
          if (bool2) {
            break label118;
          }
          if (localCollection2 == null) {
            return 0;
          }
        }
      }
      label118:
      if (!bool2) {
        if (localCollection1 == null) {
          return -1;
        }
      }
      if (localCollection2 == null) {
        return 1;
      }
      double d1 = 0.0D;
      Iterator localIterator1 = localCollection1.iterator();
      do
      {
        if (!localIterator1.hasNext()) {
          break;
        }
        ad localad1 = (ad)localIterator1.next();
        if (bool2) {
          break label219;
        }
        d1 += localad1.a(this.c, this.d);
        if (bool1) {
          break label218;
        }
      } while (!bool1);
      if (!bool2) {
        d1 /= localCollection1.size();
      }
      label218:
      label219:
      double d2 = 0.0D;
      Iterator localIterator2 = localCollection2.iterator();
      do
      {
        if (!localIterator2.hasNext()) {
          break;
        }
        ad localad2 = (ad)localIterator2.next();
        d2 += localad2.a(this.c, this.d);
        if (bool2) {
          break label313;
        }
        if (bool1) {
          break label303;
        }
      } while (!bool1);
      if (!bool2) {
        d2 /= localCollection2.size();
      }
      label303:
      label313:
      return (int)(100.0D * (d1 - d2));
    }
  }
  
  public static class b_
  {
    private final bb a = new bb();
    private final x b = db.a();
    public static int c;
    
    public void a(e parame, a.c.d paramd)
    {
      this.a.add(parame);
      this.b.a(parame, paramd);
    }
    
    public bb a()
    {
      return this.a;
    }
    
    public a.c.d a(e parame)
    {
      return (a.c.d)this.b.get(parame);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.d.a.f

 * JD-Core Version:    0.7.0.1

 */